package org.example.springbook.config;

import org.example.springbook.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;
import java.util.List;

@Configuration
public class WebMvcConfig  implements WebMvcConfigurer {
    private List<String> excluedPath= Arrays.asList(
            "/user/login",
            "/**/login.html",
            "/**/.js",
            "/**/.css",
            "/**/.pic"
    );
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                //在这里进行排除拦截了路径
                .excludePathPatterns(excluedPath);
    }
}
